<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>了解和创建代理</title>
    <script src="js/traceur.js"></script>
    <script src="js/bootstrap.js"></script>
    <script type="module">
        //创建代理
        var target = {
            age: 12
        };
        var handler = {};
        var proxy = new Proxy(target, handler);
        proxy.name = "Eden";
        console.log(target.name); //eden
        console.log(proxy.name);  //eden
        console.log(target.age);  // 12
        console.log(proxy.age);   // 12

        //不使用目标变量创建代理
        var proxy = new Proxy({
            age: 12
        }, {});
        proxy.name = "Eden";
        console.log(proxy.age); // 12
    </script>
</head>
<body>

</body>
</html>